package com.example.gmranqi.common.enums;

import java.util.HashMap;
import java.util.Map;

/**
 * @dec:
 * @author: 高总辉
 * @date: 2020/5/9
 */
public class CommentEnum {

	public  enum YesType implements EnumInterface {
		NO(0, "否"),
		YES(1, "是");

		private int code;
		private String desc;

		YesType(int code, String desc) {
			this.code = code;
			this.desc = desc;
		}

		public int getCode() {
			return this.code;
		}

		public String getDesc() {
			return this.desc;
		}

		public static YesType getByCode(int code) {
			for (YesType e : YesType.values()) {
				if (e.getCode() == code) {
					return e;
				}
			}
			return null;
		}

		public static Map<Integer, String> getMap() {
			Map<Integer, String> typeMap = new HashMap<>();
			YesType[] typeMaps = YesType.values();
			for (YesType type : typeMaps) {
				typeMap.put(type.getCode(), String.valueOf(type.getDesc()));
			}
			return typeMap;
		}
	}

}
